from .se_block import SEBlock
from torchvision import models
import torch.nn as nn


class ResNetSE(nn.Module):
    def __init__(self, num_classes, pretrained=True):
        super().__init__()
        self.base = models.resnet18(pretrained=pretrained)
        in_features = self.base.fc.in_features
        self.base.fc = nn.Linear(in_features, num_classes)
        self.base.layer4 = nn.Sequential(
            self.base.layer4,
            SEBlock(512)
        )

    def forward(self, x):
        return self.base(x)
